home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d8 / qmexprot.arc / SELECT.DOC < prev    next >
Text File  |  1991-02-04  |  6KB  |  135 lines

  1.  
  2.                                        Select
  3.                        Making your batch files more useful.
  4.  
  5.         Here it is, a simple program that allows you to ask questions in
  6.      your batch files. This program was originally written for use in a
  7.      large batch file for external protocols for Qmodem. Since Qmodem
  8.      only supports 8 externals I wrote this program to allow one batch
  9.      file then do everthing from this batch file, also saves on disk
  10.      space and the constant hassle of changing the configuration of
  11.      Qmodem to use a different protocol. Oh well enough of that, here is
  12.      how to use Select........
  13.  
  14.      The command line is as follows...
  15.           Select ABCDGER
  16.      Thats it. sounds simple, well there's more to it than that.
  17.      In your batch file you would echo or type a file that displayed to
  18.      the user the choices that they had, for example a menu system.
  19.  
  20.      echo off
  21.      echo    Welcome to my menu.
  22.      echo    [A] Qmodem 4.2d
  23.      echo    [B] Shez 5.7
  24.      echo    [C] TheDraw
  25.      Select ABC
  26.  
  27.      ok so far we have the first part of our batch file, we have echoed
  28.      or printed our choices to the screen, now comes the decision making
  29.      part of Select. The "ABC" after Select tells it that the only valid
  30.      choices for this menu are A,B, and C. Select will display the
  31.      prompt "Selection ? " and wait for a key to be pressed. If a wrong
  32.      key is pressed it will not accept it and display a message saying
  33.      so. If a valid key is pressed, Select will then exit and set the
  34.      DOS errorlevel corresponding to the placement in the list of valid
  35.      keys. So in our example, A would exit with an errorlevel of 1 and
  36.      B would exit with 2, and so on. But what if you don't want to use
  37.      A,B, or C in menu, then don't. Say our menu was changed to....
  38.  
  39.      echo off
  40.      echo    Welcome to my menu.
  41.      echo    [Q] Qmodem 4.2d
  42.      echo    [S] Shez 5.7
  43.      echo    [T] TheDraw
  44.      Select QST
  45.  
  46.      Then Q would be errorlevel 1, S would be 2, and T would be 3.
  47.  
  48.      Select <letters, numbers, or any single keystroke>
  49.      exit codes run from left to right with the first one being 1.
  50.      Also, pressing the ESC key will exit with a errorlevel of 0, this
  51.      is to allow some escape from Select as Ctrl-C does not terminate
  52.      most EXE files.
  53.  
  54.      Here is an example of a complete BAT file using Select.
  55.   ───────────────────────────────────────────────────────────────────────────
  56.  
  57.      echo off                       │ Turn command echo off
  58.      :START                         │ This is where it will loop back
  59.      cls                            │ Clear the Screen
  60.      echo    Welcome to my menu.    │ Display the menu using echo
  61.      echo    [Q] Qmodem 4.2d        │ you could make a drawing in ANSI
  62.      echo    [S] Shez 5.7           │ and use the TYPE command to
  63.      echo    [T] TheDraw            │ display it.
  64.      echo   [ESC] goto DOS          │
  65.      Select QST                     │ Call Select with Keys Q,S, T
  66.      if errorlevel 3 goto TDRAW     │ Remember, Select will return 1
  67.      if errorlevel 2 goto SHEZ      │ for Q, 2 for S, and 3 for T. And
  68.      if errorlevel 1 goto QMOD      │ you must check for them in reverse
  69.      if errorlevel 0 goto END       │ order beause of the way DOS looks
  70.                                     │ at errorlevels. The 0 is for ESC.
  71.      :TDRAW                         │ Here is the first label. We will
  72.      cd\thedraw                     │ change the current directory to
  73.      thedraw                        │ TheDraw and run this fantasic
  74.      cd\                            │ ANSI drawing program. After your
  75.      goto START                     │ done it will loop back to START
  76.                                     │ and start all over. The rest of
  77.      :SHEZ                          │ the BAT is to run other programs
  78.      cd\shez                        │ or what ever you decide to do.
  79.      shez                           │
  80.      cd\                            │ Here's SHEZ, a great ZIP, ARC, ZOO
  81.      goto START                     │ LZH shell. Makes thing easy on you.
  82.                                     │
  83.      :QMOD                          │
  84.      cd\qm                          │ And of course, here's my favorite
  85.      qmodem /stats                  │ communications program. Qmodem
  86.      cd\                            │
  87.      goto START                     │
  88.                                     │
  89.      :END                           │ The last label is for the ESC key
  90.      CD\                            │ so you can exit your batch menu
  91.      CLS                            │ and goto DOS
  92.  
  93.   ───────────────────────────────────────────────────────────────────────────
  94.  
  95.       Select can handle up to 50 different keys on the command line.
  96.      You can use $#@!^&*() if you like, just remember not to duplicate
  97.      keys because your batch will most likely do the wrong thing.
  98.  
  99.       Since this is the first thing that I have ever released into the
  100.      public I will not ask for any registration fees. This one's FREE.
  101.       In the future I will update Select to do many more things, like
  102.      command line color selection and prompts, also a placement scheme
  103.      so you can put your prompt anywhere on the screen that you want.
  104.  
  105.       Last but not least, If Select decides not to work or break let
  106.      me know. However I cannot be held responsible for any damage that
  107.      it does. Select has proven to work on my machine and a few others
  108.      and it does not contain any destructive code.
  109.  
  110.         If you have any questions I can be reached at one of the
  111.         following BBS's.
  112.  
  113.                      The Brazorian BBS
  114.                      Sysop James Kennemer
  115.                      300/1200/2400
  116.                      (409)798-0905
  117.  
  118.                      The Richwood BBS
  119.                      Sysop Carl Henderson
  120.                      300/1200/2400
  121.                      (409)265-5958
  122.  
  123.      Leave a message to Carl Henderson on any of the message boards
  124.      and I will try to respond to it within a couple of days. You
  125.      can also write to me at this address.
  126.  
  127.                      Carl Henderson
  128.                      302 N. Mahan
  129.                      Richwwod, TX 77531
  130.  
  131.      That's it ... Have fun...............................................
  132.  
  133.                                     THE END
  134.  
  135.